import { createRouter, createWebHashHistory } from 'vue-router'
const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes: [
    { path: '/', component: () => import('./dev/home/index') },
    { path: '/signin', component: () => import('./dev/login/signin') },
    { path: '/signup', component: () => import('./dev/login/signup') },
    { path: '/my', component: () => import('./dev/my/my.vue') },
    { path: '/shop', component: () => import('./dev/my/shop.vue') },
    { path: '/pay', component: () => import('./dev/my/pay.vue') },
    { path: '/yun', component: () => import('../src/yun/home/index.vue') },
    { path: '/app', component: () => import('../src/App.vue') },
  ]
})

// 让滚动条回到顶部
router.afterEach((to, from, next) => {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
  window.scrollTo(0, 0);
});

export default router;